public class P37ThreadLoacal {
  private static ThreadLocal<String> tl = new ThreadLocal<>();

  public static void main(String[] args) throws InterruptedException {
    new Thread(new Runnable() {
      @Override
      public void run() {
        tl.set("thread0");
        System.out.println(tl.get());
      }
    }).start();

    Thread.sleep(1000);

    new Thread(new Runnable() {
      @Override
      public void run() {
        System.out.println(tl.get());
        tl.set("thread1");
        System.out.println(tl.get());
      }
    }).start();
  }
}
